{% extends "base.html" %}
{% load i18n %}
<html lang="en">
<head>
    <title>Search{% if query %} Results{% endif %}</title>
</head>
{% block content %}
<body>
  <h2 class="changeBlue">Search a Client</h2>
  <form action="." method="GET">
    <label for="q">Name: </label>
	{% if query == "" %}
		 <input type="text" name="q" value=" ">
	{% else %}
    	<input type="text" name="q" value="{{ query|escape }}">
	{% endif %}
	<label for="add">Address: </label>
    <input type="text" name="add" value="{{ addquery|escape }}"><br>
   
    <input type="submit" value="Search">
  </form>

  {% if query %}
    <h3>Results for "{{ query|escape }}":</h3>
<table border='1' class="fixed">
<tr>
		<th>Sr.No </th>
		<th>Name of Parties</th>
                <th>Address</th>
                <th>Company</th>
                <th>Email Address</th>
                <th>Website</th>
                <th>Phone No</th>
		<th>Type of organisation</th>
		<th>Your Activity</th>
	</tr>
    {% if results %}
      
      {% for client in results %}
	<tr>
	<td>{{forloop.counter}}</td>
        <td> {{ client.first_name }} {{client.middle_name}} {{client.last_name}}</td>
        <td> {{client.address}},{{client.city}}</td>
        <td>{{client.company}}</td>
        <td>{{client.email_address}}</td>
        <td >{{client.website}}</td>
        <td>{{client.contact_no}}</td>
        <td>{{client.type_of_organisation}}</td>

       <td><a href="/automation/tcc/addjob/?id={{ client.id }}&job=">ADD JOB</a>|
	<a href="/automation/tcc/selectfield/?id={{ client.id }}">ADD PERFORMA JOB</a>|
	<a href="/automation/tcc/nonpayment/?id={{ client.id }}">ADD NON-PAYMENT JOB</a>|

	<a href="/automation/tcc/prevwork/?id={{ client.id }}">View Previous Work</a></td>
	
	</tr>
      {% endfor %}
      </ul>
    {% else %}
      <p>No clients found</p>
    {% endif %}
</table>
  {% endif %}
</body>
</html>
{% endblock %}
